import moduleRegist from '@/utils/moduleRegist';
import {
  module as applicationModule
} from './module';
const ListView = resolve => {
  require(['./ListView'], resolve);
};

const Layout = resolve => {
  require(['./Layout'], resolve);
};

const AddForm = resolve => {
  require(['./AddForm'], resolve);
};

const EditForm = resolve => {
  require(['./EditForm'], resolve);
};

export default [
  /** 配置管理路由 */
  {
    path: 'thirdApplication',
    redirect: 'thirdApplication/list',
    component: Layout,
    meta: {
      title: '三方应用',
      name: '三方应用',
      permission: 'auth:menu:thirdApplication:list',
      componentName: 'ThirdApplicationLayout',
      keepAlive: true,
      icon: 'ios-apps',
      show: false
    },
    beforeEnter: (to, from, next) => {
      moduleRegist(applicationModule);
      next();
    },
    children: [{
      path: 'list',
      component: ListView,
      meta: {
        title: '三方应用列表',
        name: '三方应用',
        breadcrumb: '三方应用列表',
        permission: 'auth:thirdApplication:query',
        keepAlive: true,
        componentName: 'ThirdApplicationListView',
        icon: 'ios-apps'
      }
    }, {
      path: 'add',
      component: AddForm,
      meta: {
        title: '添加三方应用',
        name: '添加三方应用',
        breadcrumb: '添加三方应用',
        permission: 'auth:thirdApplication:add',
        show: false,
        keepAlive: true,
        componentName: 'ThirdApplicationAddView',
        icon: 'ios-apps'
      }
    }, {
      path: 'edit/:id',
      component: EditForm,
      meta: {
        title: '修改三方应用',
        name: '修改三方应用',
        breadcrumb: '修改三方应用',
        permission: 'auth:thirdApplication:edit',
        show: false,
        keepAlive: false,
        componentName: 'ThirdApplicationEditView',
        icon: 'ios-apps'
      }
    }]
  }
];
